import Mock from 'mockjs'
export default {
  getMenu: config => {
    const { username, password } = JSON.parse(config.body)
    // 先判断用户是否存在
    // 判断账号和密码是否对应
    //menuList用于后面做权限分配，也就是用户可以展示的菜单
    if (username === 'admin' && password === 'admin') {
      return {
        code: 200,
        data: {
          menuList: [
            {
              path: '/home',
              name: 'home',
              label: '首页',
              icon: 'house',
              url: 'Home'
            },
            {
              path: '/mall',
              name: 'mall',
              label: '商品管理',
              icon: 'video-play',
              children: [
                {
                  path: '/malls',
                  name: 'malls',
                  label: '页面1',
                  icon: 'setting',
                  url: 'mall/mall'
                },
                {
                  path: '/mallOne',
                  name: 'mallOne',
                  label: '页面2',
                  icon: 'setting',
                  url: 'mallOne/mallOne'
                },
              ]

            },
            {
              path: '/user',
              name: 'user',
              label: '用户管理',
              icon: 'user',
              url: 'User'
            },
            {
              path: 'other',
              label: '其他',
              icon: 'location',
              children: [
                {
                  path: '/page1',
                  name: 'page1',
                  label: '页面1',
                  icon: 'setting',
                  url: 'Page1'
                },
                {
                  path: '/page2',
                  name: 'page2',
                  label: '页面2',
                  icon: 'setting',
                  url: 'Page2'
                },
                {
                  path: '/page3',
                  name: 'page3',
                  label: '页面3',
                  icon: 'setting',
                  url: 'announcement/AnnounInfo'
                },
                {
                  path: '/page4',
                  name: 'page4',
                  label: '页面4',
                  icon: 'setting',
                  url: 'Page4'
                },
                {
                  path: '/page5',
                  name: 'page5',
                  label: '页面5',
                  icon: 'setting',
                  url: 'Page5'
                },
                {
                  path: '/page6',
                  name: 'page6',
                  label: '页面6',
                  icon: 'setting',
                  url: 'Page6'
                },
                {
                  path: '/page7',
                  name: 'page7',
                  label: '页面7',
                  icon: 'setting',
                  url: 'Page7'
                },
                {
                  path: '/page8',
                  name: 'page8',
                  label: '页面8',
                  icon: 'setting',
                  url: 'Page8'
                }
              ]
            },
            {
              path: 'Eacharts',
              label: '图表',
              icon: 'HelpFilled',
              children: [
                {
                  path: '/zhuzhuangtu1',
                  name: 'zhuzhuangtu1',
                  label: '柱状图1',
                  icon: 'Histogram',
                  url: 'Eacharts/zhuzhuangtu1'
                },
                {
                  path: '/zhuzhuangtu2',
                  name: 'zhuzhuangtu2',
                  label: '柱状图2',
                  icon: 'Histogram',
                  url: 'Eacharts/zhuzhuangtu2'
                },
                {
                  path: '/ditu',
                  name: 'ditu',
                  label: '地图',
                  icon: 'Histogram',
                  url: 'Eacharts/ditu/ditu'
                }
              ]
            },
            {
              path: 'carousel',
              label: '跑马灯',
              icon: 'location',
              children: [
                {
                  path: '/carouselDome',
                  name: 'carouselDome',
                  label: '页面1',
                  icon: 'setting',
                  url: 'carousel/carouselDome'
                }
              ]
            },
            {
              path: 'domeFzhuang',
              label: '封装',
              icon: 'location',
              children: [
                {
                  path: '/domeFzhuang',
                  name: 'domeFzhuang',
                  label: '页面1',
                  icon: 'setting',
                  url: 'domeFzhuang/domeFzhuangIndex'
                },
                {
                  path: '/dome1',
                  name: 'dome1',
                  label: '页面2',
                  icon: 'setting',
                  url: 'domeFzhuang/dome/dome'
                }
              ]
            },
            {
              path: 'biaodanxiangguan',
              label: '表单相关',
              icon: 'location',
              children: [
                {
                  path: '/office',
                  name: 'office',
                  label: 'vue-office',
                  icon: 'setting',
                  url: 'biaodanxiangguan/office'
                }
              ]
            }
          
          ],
          token: Mock.Random.guid(),
          message: '获取成功'
        }
      }
    } else if (username === 'xiaoxiao' && password === 'xiaoxiao') {
      return {
        code: 200,
        data: {
          menuList: [
            {
              path: '/home',
              name: 'home',
              label: '首页',
              icon: 'house',
              url: 'Home'
            },
            {
              path: '/user',
              name: 'user',
              label: '用户管理',
              icon: 'user',
              url: 'User'
            }
          ],
          token: Mock.Random.guid(),
          message: '获取成功'
        }
      }
    } else {
        
      return {
        code: -999,
        data: {
          message: '密码错误'
        }
      }
        
    }

  }
}